package com.bristua.barcode.customer.controller;

import com.bristua.barcode.common.bean.Result;
import com.bristua.barcode.common.util.HandleResultUtil;
import com.bristua.barcode.customer.biz.AddCustomerBindQRCodeBiz;
import com.bristua.barcode.customer.biz.CustomerBindQRCodeWriteIntoRedisBiz;
import com.bristua.barcode.customer.model.condition.AddCustomerBindQRCodeParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2019/8/9.
 */
@RestController
public class AddCustomerBindQRCodeController {

    @Autowired
    private AddCustomerBindQRCodeBiz addCustomerBindQRCodeBiz;

    @Autowired
    private CustomerBindQRCodeWriteIntoRedisBiz customerBindQRCodeWriteIntoRedisBiz;

    @PostMapping(value = "/customer/bind/qrcode")
    public Result addCustomer(@RequestBody AddCustomerBindQRCodeParams addCustomerBindQRCodeParams){
        addCustomerBindQRCodeBiz.addCustomerBindQRCode(addCustomerBindQRCodeParams);
        customerBindQRCodeWriteIntoRedisBiz.customerBindQRCodeWriteIntoRedis(addCustomerBindQRCodeParams.getCustomerId());
        return HandleResultUtil.addSuccessResult();
    }
}
